#pragma once
#include <string>
#include <memory>
#include <sstream>
#include "LogLevel.h"

namespace log
{

class LogEvent
{
public:
    using ptr = std::shared_ptr<LogEvent>; 
    LogEvent(LogLevel::ELevel eLevel, uint32_t nTid, const std::string& strTime
            , const std::string& strFile, const std::string& strFunc, uint32_t nLine);

    LogLevel::ELevel getLevel() const {return m_eLevel; }
    uint32_t getTid() const { return m_nTid; }
    std::string getTime() const { return m_strTime; }
    std::string getFile() const { return m_strFile; }
    std::string getFunc() const { return m_strFunc; }
    uint32_t getLine() const { return m_nLine; }
    std::string getMsg() const { return m_os.str(); }

    void setLevel(LogLevel::ELevel eLevel) { m_eLevel = eLevel; }
    void setTid(const uint32_t& nTid) { m_nTid = nTid; }
    void setTime(const std::string& strTime) { m_strTime = strTime; }
    void setFile(const std::string& strFile) { m_strFile = strFile; }
    void setFunc(const std::string& strFunc) { m_strFunc = strFunc; }
    void setLine(const uint32_t& nLine) { m_nLine = nLine; }
    void setMsg(const std::string& strMsg) { m_os << strMsg; }

    std::ostringstream& stream() { return m_os; }

private:
    LogLevel::ELevel m_eLevel;
    uint32_t m_nTid;
    std::string m_strTime;
    std::string m_strFile;
    std::string m_strFunc;
    uint32_t m_nLine;
    std::ostringstream m_os;    
};
    
} // namespace log
